import { createSlice } from '@reduxjs/toolkit'

const initialState = {
  cityList:{
    start:'北京',
    end:'上海'
  }
}

export const citySlice = createSlice({
  name: 'city',
  initialState,
  reducers: {
    getStart: (state, action) => {
      state.cityList.start = action.payload
    },
    getEnd: (state, action) => {
      state.cityList.end = action.payload
    },
  },
})

// Action creators are generated for each case reducer function
export const { getStart ,getEnd} = citySlice.actions

export default citySlice.reducer